import request from "@/utils/request.js";

/**
 * 分页查询
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const queryResultPage = (data) => {
  return request.post("/admin/result/page", data);
};

/**
 * 通过id获取
 * @param id
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const getResultById = (id) => {
  return request.get(`/admin/result/${id}`);
};

/**
 * 新增评分结果
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const addResult = (data) => {
  return request.post("/admin/result", data);
};

/**
 * 删除评分结果
 * @param data 包含多个结果ID的数组
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const removeResult = (data) => {
  return request.delete("/admin/result", { data });
};

/**
 * 编辑评分结果
 * @param data
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const editResult = (data) => {
  return request.put("/admin/result", data);
};

/**
 * 导出评分结果信息表格
 * @param data 包含多个结果ID的数组
 * @returns {Promise<axios.AxiosResponse<any>>}
 */
export const exportResult = (data) => {
  return request.post("/admin/result/export", data, { responseType: 'blob' });
};
